{include file="public/com_header"}
<body style="padding:10px;">
  <div class="tplay-body-div">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
      <form class="layui-form serch" action="{:url('admin/admin/loginLog')}" method="post">
        <div class="layui-form-item" style="float: left;">
          <div class="layui-input-inline">
            <div class="layui-inline">
                <select name="admin_id" lay-search="">
                  <option value="">操作人</option>
                  {volist name="$admin" id="vo"}
                  <option value="{$vo.id}">{$vo.nickname}</option>
                  {/volist}
                </select>
            </div>
          </div>
          <div class="layui-input-inline">
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="login_time" placeholder="登录时间" name="login_time">
              </div>
            </div>
          </div>
          <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
        </div>
      </form> 
      
    </fieldset>
    <table class="layui-table" lay-size="sm">
      <thead>
        <tr>
          <!--<th width="25"><input type="checkbox" value="" name=""></th>-->
          <th width="">用户ID</th>
          <th width="">账号</th>
          <th width="">用户姓名</th>
          <th width="">登录IP</th>
          <th width="">登录地点</th>
          <th width="">浏览器</th>
          <th width="">操作系统</th>
          <th width="">登录时间</th>
        </tr> 
      </thead>
      <tbody>
        {volist name="loginLog" id="vo"}
        <tr>
          <!--<td><input type="checkbox" name="id[]" value="{$vo.id}"></td>-->
          <td >{$vo.admin_id}</td>
          <td>{$vo.name}</td>
          <td>{$vo.nickname}</td>
          <td><span style="background-color:#00A65A;color: #ffffff;">{$vo.login_ip}</span></td>
          <td>{$vo.login_location}</td>
          <td>{$vo.login_browser}</td>
          <td>{$vo.login_os}</td>
          <td>{$vo.login_date}</td>
        </tr>
        {/volist}
      </tbody>
    </table>
    <div style="padding:0 20px;">{$loginLog->render()}</div>
            
    <!--<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>-->
    <!--<script src="__PUBLIC__/jquery/jquery.min.js"></script>-->
    <!--<script>-->
            <!--var message;-->
            <!--layui.config({-->
                <!--base: '__JS__/',-->
                <!--version: '1.0.1'-->
            <!--}).use(['app', 'message'], function() {-->
                <!--var app = layui.app,-->
                    <!--$ = layui.jquery,-->
                    <!--layer = layui.layer;-->
                <!--//将message设置为全局以便子页面调用-->
                <!--message = layui.message;-->
                <!--//主入口-->
                <!--app.set({-->
                    <!--type: 'iframe'-->
                <!--}).init();-->
            <!--});-->
        <!--</script> -->
      {include file="public/com_js"}
    <script type="text/javascript">
    $(function(){
      var x = 10;
      var y = 20;
      $(".tooltip").mouseover(function(e){ 
        var tooltip = "<div id='tooltip'><img src='"+ this.href +"' alt='预览图' height='200'/>"+"<\/div>"; //创建 div 元素
        $("body").append(tooltip);  //把它追加到文档中             
        $("#tooltip")
          .css({
            "top": (e.pageY+y) + "px",
            "left":  (e.pageX+x)  + "px"
          }).show("fast");    //设置x坐标和y坐标，并且显示
        }).mouseout(function(){  
        $("#tooltip").remove();  //移除 
        }).mousemove(function(e){
        $("#tooltip")
          .css({
            "top": (e.pageY+y) + "px",
            "left":  (e.pageX+x)  + "px"
          });
      });
    })

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/attachment/delete')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    })
    </script>
    <script type="text/javascript">
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //常规用法
            laydate.render({
                elem: '#login_time',
                range : true,
                min: '2018-01-01',
                max: '2100-12-31',
            });
        });


      layui.use('layer', function(){
        var layer = layui.layer;
        $('.open').click(function(){
          var id = $(this).attr('data-id');
          layer.msg('文件审核',{
            time:20000
            ,btn: ['仁慈通过', '残忍拒绝', '再想想']
            ,yes: function(index, layero){
              $.ajax({
                url:"{:url('admin/attachment/audit')}"
                ,type:'post'
                ,data:{id:id,status:'1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
            ,btn2: function(index, layero){
              $.ajax({
                url:"{:url('admin/attachment/audit')}"
                ,type:'post'
                ,data:{id:id,status:'-1'}
                ,success:function(res){
                  layer.msg(res.msg);
                  if(res.code == 1){
                    setTimeout(function(){
                      location.href = res.url;
                    },1500)
                  }
                }
              })
            }
          })
        })
      });              
    </script>
    <script>
    layui.use('laydate', function(){
      var laydate = layui.laydate;
      
      //常规用法
      laydate.render({
        elem: '#create_time'
      });
    });
    </script>
</div>
</body>
</html>
